package main

import (
	"fmt"
	"sync"
	"time"
)

var once  sync.Once //可以保证在多协程中只运行一次


func onceFunc(){
	for i := 0; i < 10; i++ {
		go func(){
			once.Do(func(){
				fmt.Println("________once___")
			})
		}()
	}
}
func main() {

	onceFunc()
	onceFunc()
	time.Sleep(5*time.Second)
}

